// import BigNumber from "bignumber.js"
function timeAdd(m){
			return m<10 ? '0'+m : m;
}
/**
 * 获取当前时间并格式化 xxxx-xx-xx xx:xx:xx
 */
export const getNowFormatDate = () => {
	var date1 = new Date();
	var year = date1.getFullYear();
	var month = date1.getMonth() + 1;
	var day = date1.getDate();
	var hours = date1.getHours();
	var minutes = date1.getMinutes();
	var seconds = date1.getSeconds();
	return timeAdd(year) + "-" + timeAdd(month) + "-" + timeAdd(day) + " " + timeAdd(hours) + ":" + timeAdd(minutes) + ":" + timeAdd(seconds)
}
/**
 * 获取当前时间并格式化 xxxx年xx月xx日
 */
export const getDate = () => {
	var date1 = new Date();
	var year = date1.getFullYear();
	var month = date1.getMonth() + 1;
	var day = date1.getDate();
	return timeAdd(year) + "年" + timeAdd(month) + "月" + timeAdd(day) + '日'
}
/**
 * 获取下一天并格式化 xxxx-xx-xx
 * @param {*} day 
 */
export const getTomorrow = (day1) =>{
	console.log(day1)

	var date = new Date(day1).getTime()+86400000
	var date1 = new Date(date)
	var year = date1.getFullYear();
	var month = date1.getMonth() + 1;
	var day = date1.getDate();
	return timeAdd(year) + "-" + timeAdd(month) + "-" + timeAdd(day)
}
/**
 * 格式化时间 xx-xx xx:xx:xx
 * @param {*} time 
 */
export const getYRSFM = (time) =>{
	var date = new Date(time)
	var month = date.getMonth() + 1;
	var day = date.getDate();
	var hours = date.getHours();
	var minutes = date.getMinutes();
	var seconds = date.getSeconds();
	return timeAdd(month) + "-" + timeAdd(day) + " " + timeAdd(hours) + ":" + timeAdd(minutes) + ":" + timeAdd(seconds)
}

/**
 * 格式化时间 xxxx-xx-xx xx:xx:xx
 */
export const getYMDHMS = (time) => {
	var date1 = new Date(time);
	var year = date1.getFullYear();
	var month = date1.getMonth() + 1;
	var day = date1.getDate();
	var hours = date1.getHours();
	var minutes = date1.getMinutes();
	var seconds = date1.getSeconds();
	return timeAdd(year) + "-" + timeAdd(month) + "-" + timeAdd(day) + " " + timeAdd(hours) + ":" + timeAdd(minutes) + ":" + timeAdd(seconds)
}
/**
 * 格式化传入的时间
 * @param {*} time 
 */
export const getNYR = (time) =>{
	var date = new Date(time)
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var day = date.getDate();
	return timeAdd(year)+timeAdd(month)+timeAdd(day)
}

/**
 * 传入时间跟小时，根据小时拿到之后的时间
 * @param {时间} time 
 * @param {几小时后} hours 
 */
export const hoursLater = (time,hours1) =>{
	let haoMiao = Number(hours1)*3600000
	var date = new Date(new Date(time).getTime()+haoMiao)
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var day = date.getDate();
	var hours = date.getHours();
	var minutes = date.getMinutes();
	var seconds = date.getSeconds();
	return timeAdd(year) + "-" + timeAdd(month) + "-" + timeAdd(day) + " " + timeAdd(hours) + ":" + timeAdd(minutes) + ":" + timeAdd(seconds)
}

/**
 * 传入起止时间 求总秒数
 * @param {*} start 
 * @param {*} end 
 */
export const secondsCount =(start,end) =>{
	let startTime = new Date(start).getTime()/1000
	let endTime = new Date(end).getTime()/1000
	// return BigNumber(endTime).minus(startTime).toString()
	return (endTime).minus(startTime).toString()

}